<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .main{
            height: 400px;
            background: skyblue;
            display: grid;
            /* grid-template-columns: 100px 100px 100px; */
            /* grid-template-columns: repeat(3,100px); */
            /* grid-template-columns: 150px 100px 100px; */
            /* grid-template-columns: 150px repeat(2,100px); */

            grid-template-columns: repeat(auto-fill,100px);
            grid-template-rows: 100px;
        }
        .main div{
            background: pink;
        }
    </style>
</head>
<body>
    <div class="main">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
    </div>
</body>
</html>